Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

409
Visualizações
Jinja2 HTML templates use multiple nested quotation marks (" and ')

The question is simple, I am using jinja2 html templates and I am supposed to include {{ url_for('static', filename='img/background.png') }} inside of url(''), inside of style="".

The proble is that there is a quotation mark conflict, because there are two nested ' marks

<body id="body-pd" style="background: url('{{ url_for('static', filename='img/background.png') }}') no-repeat center center fixed; background-size: cover;">

Is there some sort of scape character to be used?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The answer to this problem is also very simple: there's no problem. The Jinja environment (server side) and browser/frontend environment have different lifecycle.

Jinja only sees this part:

{{ url_for('static', filename='img/background.png') }}

It produces a path, e.g. /static/img/background.png and replaces the whole {{ ... }} snippet with it. The frontend environment never sees Jinja-related parts. So there's no quotation mark conflict, because half of them will be eliminated by Jinja on the server side.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda